using System;
using AntEater.ComponentModel.Validation;
using System.Collections.ObjectModel;

namespace AntEater.Runtime.Services.Validation
{
    /// <summary>
    /// The validation service interface defines a common interface for 
    /// a validation service.
    /// </summary>
    public interface IValidationService : IRuntimeService
    {
        /// <summary>
        /// Validates the specified target.
        /// </summary>
        /// <param name="target">The target of the validation process.</param>
        /// <returns></returns>
        ReadOnlyCollection<ValidationResult> Validate(IValidatable target);

        /// <summary>
        /// Validates the specified target.
        /// </summary>
        /// <param name="target">The target of the validation process.</param>
        /// <param name="context">The context in which the target should be validated.</param>
        /// <returns></returns>
        ReadOnlyCollection<ValidationResult> Validate(IValidatable target, IValidatable context);

        /// <summary>
        /// Validates the specified target.
        /// </summary>
        /// <param name="target">The target of the validation process.</param>
        /// <param name="results">The validation results to which the new results should be added.</param>
        /// <returns></returns>
        ReadOnlyCollection<ValidationResult> Validate(IValidatable target, ReadOnlyCollection<ValidationResult> results);

        /// <summary>
        /// Validates the specified target.
        /// </summary>
        /// <param name="target">The target of the validation process.</param>
        /// <param name="context">The context in which the target should be validated.</param>
        /// <param name="results">The validation results to which the new results should be added.</param>
        /// <returns></returns>
        ReadOnlyCollection<ValidationResult> Validate(IValidatable target, IValidatable context, ReadOnlyCollection<ValidationResult> results);
    }
}
